﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmUsuarios.aspx.cs" Inherits="WebMotel.frmUsuarios" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


          
            <div runat="server" id="divMensagem" class="mensagem">
                    <p runat="server" id="pMensagem"></p>
            </div>


    <div id="page-content" class="clearfix">
        <div class="page-header position-relative">
            <h1>
                Usuários
                <small>
                <i class="icon-double-angle-right"></i>
                    Utilize esta página para relaizar a pesquisa, alterar ou inserir novos Usuários.
                </small>
            </h1>
        </div>


        <div class="tabbable">
            <ul id="myTab" class="nav nav-tabs">
                <li class="active" id="li_pesquisar">
                    <a href="#div_pesquisar" data-toggle="tab">
                    <i class="green icon-search bigger-110"></i>
                        Pesquisar
                    </a>
                </li>
                <li class=""  id="li_editar">
                    <a href="#div_editar" data-toggle="tab">
                    <i class="green icon-edit bigger-110"></i>
                        Editar
                    </a>
                </li>
                 <li class="" id="li_cadastrar">
                    <a href="#div_cadastrar" data-toggle="tab">
                    <i class="green icon-save bigger-110"></i>
                        Novo
                    </a>
                </li>
            </ul>
            <div class="tab-content">

    <div id="div_pesquisar" class="tab-pane active" >           

        <div class="row-fluid">
            
            <h3 class="header smaller lighter grey">
            <i class="icon-search green"></i>
            Pesquisar
            
            </h3>


            <div style="float:left; width:100%; height:auto;">
                <div style="float:left; height:auto; margin-right:10px;">
                    <label class="control-label" for="txtPesquisar_ID">ID:</label>
                    <asp:TextBox ID="txtPesquisar_ID" class="ace-tooltip" runat="server" Width="60px" />
                </div>
                <div style="float:left; height:auto; margin-right:10px;">
                    <label class="control-label" for="ddlPesquisar_TipoUsuario">Tipo Usuário:</label>
                    <asp:DropDownList ID="ddlPesquisar_TipoUsuario" runat="server"></asp:DropDownList>
                </div>
                <div style="float:left; height:auto; margin-right:10px;">
                    <label class="control-label" for="txtPesquisar_NomeCompleto">Nome:</label>
                    <asp:TextBox ID="txtPesquisar_NomeCompleto" class="ace-tooltip" runat="server" Width="360px" />
                </div>
                <div style="float:left; height:auto; margin-right:10px;">
                    <label class="control-label" for="txtPesquisar_Login">Login:</label>
                    <asp:TextBox ID="txtPesquisar_Login" class="ace-tooltip" runat="server" Width="360px" />
                </div>

                <div style="float:left; height:auto; margin-right:10px;">
                    <label class="control-label" for="txtPesquisar_Descricao">.</label>
                    <asp:LinkButton ID="btnPesquisar" runat="server" CssClass="btn btn-purple btn-small" OnClick="btnPesquisar_OnClick" >
                        <i class="icon-search icon-on-right bigger-110"></i>
                        Pesquisar
                    </asp:LinkButton>
                </div>
            </div>
        </div>


        <br clear="all" />
        <div class="row-fluid">
            <div class="table-header"> Resultado(s) para "Usuários" </div>         

                <div id="table_report_wrapper" class="dataTables_wrapper" role="grid">
                    <asp:Repeater ID="rptListagem" runat="server">
                        <HeaderTemplate>
                             <table class="table table-striped table-bordered table-hover dataTable" id="table_report" aria-describedby="table_report_info">
								<thead>
									<tr role="row">
                                        <th class="sorting" role="columnheader" tabindex="0" aria-controls="table_report" rowspan="1" colspan="1" style="width: 7%;" aria-label="Domain: activate to sort column ascending">
                                            ID
                                        </th>
                                        
                                        <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="table_report" rowspan="1" colspan="1" style="width: 15%;" aria-label="Status: activate to sort column ascending">
                                            Tipo
                                        </th>

                                        <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="table_report" rowspan="1" colspan="1" style="width: 15%;" aria-label="Status: activate to sort column ascending">
                                            Login
                                        </th>

                                        <th class="hidden-480 sorting" role="columnheader" tabindex="0" aria-controls="table_report" rowspan="1" colspan="1" style="width: 63%;" aria-label="Status: activate to sort column ascending">
                                            Nome
                                        </th>
                                        
                                        <th></th>
                                    </tr>
                               	</thead>								
							<tbody role="alert" aria-live="polite" aria-relevant="all">
                        </HeaderTemplate>
                        <ItemTemplate>
                            <tr class='<%# Container.ItemIndex % 2 == 0 ? "odd" : "even" %>'>
							    <td class="">
								    <%# Eval("ID") %>
							    </td>
                                <td class="">
								    <%# Eval("Tipo") %>
							    </td>
                                <td class="">
								    <%# Eval("Login") %>
							    </td>
                                <td class="">
								    <%# Eval("Nome") %>
							    </td>
                                <td class="td-actions ">
                                    <div class="hidden-phone visible-desktop btn-group">
                                        <asp:LinkButton class="btn btn-mini btn-info" runat="server" ID="btnCarregaForm" ToolTip='<%# "Editar: " + Eval("Nome") %>' CommandArgument='<%# Eval("ID") %>' OnClick="btnCarregaForm_OnClick" >
                                            <i class="icon-edit bigger-120"></i>
                                        </asp:LinkButton>

                                        <asp:LinkButton class="btn btn-mini btn-danger" runat="server" ID="btnExcluir" ToolTip='<%# "Excluir: " + Eval("Nome") %>' CommandArgument='<%# Eval("ID") %>' OnClick="btnExcluir_OnClick" OnClientClick="javascript:return confirm('Deseja realmente excluir este registro?');" >
                                            <i class="icon-trash bigger-120"></i>
                                        </asp:LinkButton>
                                    </div>
                                </td>
                            </tr>
                        </ItemTemplate>
                        <FooterTemplate>
                                </tbody>
                            </table>

                            <div class="row-fluid">
                                <div class="span6">
                                    <div class="dataTables_paginate paging_bootstrap pagination">
                                        <ul>
                                            <li class="prev">
                                              <asp:LinkButton ID="lnkAnterior" runat="server" OnClick="lnkAnterior_Click">
                                                    <i class="icon-double-angle-left"></i>
                                                </a>
                                            </asp:LinkButton>
                                             <li class="next">
                                                <asp:LinkButton ID="lnkProximo" runat="server" OnClick="lnkProximo_Click">
                                                    <i class="icon-double-angle-right"></i>
                                                </asp:LinkButton>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </FooterTemplate>
                    </asp:Repeater>
 

                </div>
        </div>

    </div>
    


                <!-- FORM EDITAR -->
                <div id="div_editar" class="tab-pane ">
                   <h3 class="header smaller lighter purple"> <i class="icon-edit purple"></i> Editar</h3>

                    <div style="float:left; width:100%; height:auto;">

                        <div style="float:left; width:100%; height:auto;">
                            <div style="float:left; height:auto; margin-right:10px;">
                                <label class="control-label" for="txtEditar_ID">ID:</label>
                                <asp:TextBox ID="txtEditar_ID" class="ace-tooltip grey" runat="server" Width="60px" ReadOnly="true" />
                                <asp:RequiredFieldValidator ID="RFV_txtEditar_ID" ControlToValidate="txtEditar_ID" runat="server" Display="None" ErrorMessage="Por favor, selecione um registro para alterar." ValidationGroup="alterar"></asp:RequiredFieldValidator>
                                <asp:ValidatorCalloutExtender ID="VCE_txtEditar_ID" runat="server" Enabled="True" TargetControlID="RFV_txtEditar_ID"> </asp:ValidatorCalloutExtender>              
                            </div>
                        </div>

                        <br clear="all" />

                      <div style="float:left; width:100%; height:auto;">
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="ddlEditar_TipoUsuario">Tipo Usuário:</label>
                            <asp:DropDownList ID="ddlEditar_TipoUsuario" runat="server"></asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RFV_ddlEditar_TipoUsuario" ControlToValidate="ddlEditar_TipoUsuario" runat="server" InitialValue="- -" Display="None" ErrorMessage="Por favor, informe o Tipo Usuário." ValidationGroup="alterar"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="VCE_ddlEditar_TipoUsuario" runat="server" Enabled="True" TargetControlID="RFV_ddlEditar_TipoUsuario"> </asp:ValidatorCalloutExtender>              
                        </div>
                    </div>
                    <div style="float:left; width:100%; height:auto;">
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="txtEditar_NomeCompleto">Nome Completo:</label>
                            <asp:TextBox ID="txtEditar_NomeCompleto" class="ace-tooltip" runat="server" Width="320px" />
                            <asp:RequiredFieldValidator ID="RFV_txtEditar_NomeCompleto" ControlToValidate="txtEditar_NomeCompleto" runat="server" Display="None" ErrorMessage="Por favor, informe o Nome Completo." ValidationGroup="alterar"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="VCE_txtEditar_NomeCompleto" runat="server" Enabled="True" TargetControlID="RFV_txtEditar_NomeCompleto"> </asp:ValidatorCalloutExtender>               
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="txtEditar_Login">Login:</label>
                            <asp:TextBox ID="txtEditar_Login" class="ace-tooltip" runat="server" Width="180px" />
                            <asp:RequiredFieldValidator ID="RFV_txtEditar_Login" ControlToValidate="txtCadastrar_Login" runat="server" Display="None" ErrorMessage="Por favor, informe o Login." ValidationGroup="alterar"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="VCE_txtEditar_Login" runat="server" Enabled="True" TargetControlID="RFV_txtEditar_Login"> </asp:ValidatorCalloutExtender>               
        
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="txtEditar_Senha">Senha:</label>
                            <asp:TextBox ID="txtEditar_Senha" class="ace-tooltip" runat="server" Width="120px" TextMode="Password" />
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;" >
                            <label class="control-label" for="ddlEditar_Ativo">Ativo:</label>
                            <asp:DropDownList ID="ddlEditar_Ativo" runat="server" Width="80px">
                                <asp:ListItem Value="S" Text="Sim"></asp:ListItem>
                                <asp:ListItem Value="N" Text="Não"></asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </div>


                    </div>

                    <br clear="all" />
                    
                    <div style="float:left; width:100%; height:auto; margin:10px 0px 0px 0px;">
                        <div style="float:left; height:auto; margin-right:10px;">
                            <asp:LinkButton class="btn btn-prev" runat="server" ID="btnEditarVoltar" OnClick="btnEditarVoltar_OnClick" CausesValidation="false">
                                <i class="icon-arrow-left"></i>
                                Voltar
                           </asp:LinkButton>                            
                        </div>

                        <div style="float:left; height:auto; margin-right:10px;">
                            <asp:LinkButton class="btn btn-info" runat="server" ID="btnEditarSalvar" OnClick="btnEditarSalvar_OnClick" ValidationGroup="alterar">
                                <i class="icon-ok bigger-110"></i>
                                Salvar
                           </asp:LinkButton>                            
                        </div>
                    </div>
                </div>



                <!-- FORM NOVO -->
                <div id="div_cadastrar" class="tab-pane " >
                   <h3 class="header smaller lighter purple"> <i class="icon-save purple"></i> Novo</h3>

                    <div style="float:left; width:100%; height:auto;">
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="ddlCadastrar_TipoUsuario">Tipo Usuário:</label>
                            <asp:DropDownList ID="ddlCadastrar_TipoUsuario" runat="server"></asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RFV_ddlCadastrar_TipoUsuario" ControlToValidate="ddlCadastrar_TipoUsuario" runat="server" InitialValue="- -" Display="None" ErrorMessage="Por favor, informe o Tipo Usuário." ValidationGroup="cadastrar"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="VCEE_ddlCadastrar_TipoUsuario" runat="server" Enabled="True" TargetControlID="RFV_ddlCadastrar_TipoUsuario"> </asp:ValidatorCalloutExtender>              
                        </div>
                    </div>
                    <div style="float:left; width:100%; height:auto;">
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="txtCadastrar_NomeCompleto">Nome Completo:</label>
                            <asp:TextBox ID="txtCadastrar_NomeCompleto" class="ace-tooltip" runat="server" Width="320px" />
                            <asp:RequiredFieldValidator ID="RFV_txtCadastrar_NomeCompleto" ControlToValidate="txtCadastrar_NomeCompleto" runat="server" Display="None" ErrorMessage="Por favor, informe o Nome Completo." ValidationGroup="cadastrar"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="VCEE_txtCadastrar_NomeCompleto" runat="server" Enabled="True" TargetControlID="RFV_txtCadastrar_NomeCompleto"> </asp:ValidatorCalloutExtender>               
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="txtCadastrar_Login">Login:</label>
                            <asp:TextBox ID="txtCadastrar_Login" class="ace-tooltip" runat="server" Width="180px" />
                            <asp:RequiredFieldValidator ID="RFV_txtCadastrar_Login" ControlToValidate="txtCadastrar_Login" runat="server" Display="None" ErrorMessage="Por favor, informe o Login." ValidationGroup="cadastrar"></asp:RequiredFieldValidator>
                            <asp:ValidatorCalloutExtender ID="VCE_txtCadastrar_Login" runat="server" Enabled="True" TargetControlID="RFV_txtCadastrar_Login"> </asp:ValidatorCalloutExtender>               
        
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;">
                            <label class="control-label" for="txtCadastrar_Senha">Senha:</label>
                            <asp:TextBox ID="txtCadastrar_Senha" class="ace-tooltip" runat="server" Width="120px" TextMode="Password" />
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;" >
                            <label class="control-label" for="ddlCadastrar_Ativo">Ativo:</label>
                            <asp:DropDownList ID="ddlCadastrar_Ativo" runat="server" Width="80px">
                                <asp:ListItem Value="S" Text="Sim"></asp:ListItem>
                                <asp:ListItem Value="N" Text="Não"></asp:ListItem>
                            </asp:DropDownList>
                        </div>
                    </div>

                    <br clear="all" />
                    
                    <div style="float:left; width:100%; height:auto; margin:10px 0px 0px 0px;">
                        <div style="float:left; height:auto; margin-right:10px;">
                            <asp:LinkButton class="btn btn-prev" runat="server" ID="btnCadastrarVoltar" OnClick="btnCadastrarVoltar_OnClick" CausesValidation="false">
                                <i class="icon-arrow-left"></i>
                                Voltar
                           </asp:LinkButton>                            
                        </div>
                        <div style="float:left; height:auto; margin-right:10px;">
                            <asp:LinkButton class="btn btn-info" runat="server" ID="btnCadastrarSalvar" OnClick="btnCadastrarSalvar_OnClick" ValidationGroup="cadastrar">
                                <i class="icon-save bigger-110"></i>
                                Cadastrar
                           </asp:LinkButton>                            
                        </div>
                    </div>
                </div>

                </div>
            </div>
        </div>
  

</asp:Content>
